Function.prototype.ddCall = function (thisArg, ...args) {
  console.log('ddCall执行了')
  var fn = this
  //用于排除thisArg为null或undefined的情况
  thisArg = (thisArg !== null && thisArg !== undefined) ? Object(thisArg) : window
  thisArg.fn = fn
  var res = thisArg.fn(...args)
  delete thisArg.fn
  return res
}

function foo(item) {
  console.log(this)
  console.log('foo执行了', item)
  return item
}

// foo()
var res = foo.ddCall('abc', '123')
console.log(res)


